//
//  SNContentTenmentDataManager.m
//  app
//
//  Created by 王少宁 on 15/8/31.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "SNContentTenmentDataManager.h"

@interface SNContentTenmentDataManager ()
@property (nonatomic, retain) JKHttpClient * http;
@property (nonatomic, retain) SNUniteUrl * uniteUrl;
@end

@implementation SNContentTenmentDataManager

+ (SNContentTenmentDataManager *)shareManager
{
    AS_SINGLETON(SNContentTenmentDataManager, manager, {
        manager = [[SNContentTenmentDataManager alloc] init];
        manager.http = [[JKHttpClient alloc] init];
        manager.uniteUrl = [SNUniteUrl shareUniteUrl];
    })
    return manager;
}

- (void)loadDataWithResult:(SNContentTenmentResult *)result
{
    if ([self.http isRunning]) {
        return;
    }
    
    result.success = NO;
    result.failure = YES;
    
    NSString * url = @"http://mylife114.com/mall/myorders/getSelectAddress";
    
    [self.http get:self.uniteUrl.per_contentTenementUrl result:^(JKResponse *resp) {
        if (resp.status == JKResponseOK) {
            result.success = YES;
            result.failure = NO;
            result.model = [SNRepairAskModel modelWithDict:resp.content];
        }
        [result invoke];
    }];
}

@end
